// @ts-ignore
/* eslint-disable */
import request from 'umi-request';

//线上环境
//const PORT = 'http://8.135.54.87:9999'
//本地环境
//const PORT = 'http://192.168.1.76:9999'
//const PORT = 'http://47.245.33.153:9999'
import {PORT} from '../requestPath/index'
//import sha256  from 'crypto-js/sha256'
/** 获取当前的用户 GET /api/currentUser */
export async function integralList(
  params?:API.OrderInsIntegralDto
) {
  return request<{
    data: API.OrderInsIntegralDto;
  }>(PORT+'/api/order/integral/list/'+params?.page+'/'+params?.limit, {
    method: 'POST',
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`,
      //"sign":`${sha256('ezblu'+localStorage.getItem("token"))}`
    },
    data:params
  });
}


/**修改用户信息 */
export async function userUpdate(
  params:API.Item
){
return request<{data:number}>(
  PORT+"/api/user/update",{
    method:"PUT",
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`
    },
    data:params
  });
}


/**删除用户信息 */
export async function userDelete(id:number){
return request<{data:number}>(
  PORT+"/api/user/delete/"+id,{
    method:"DELETE",
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`
    },
  });
}


/**新增用户信息 */
export async function userInputAdd(
  params:API.Item
){
  return request<{data:number}>(
    PORT+"/api/user/input/add",{
      method:"POST",
      headers:{
        "Authorization":`${localStorage.getItem("token")}`,
        "TimeSystemCurrent":`${new Date().getTime()}`
      },
      data:params
    });
}

/***获取统计信息 */
export async function userCoutnList() {
  return request<{
    data: API.ZgUserCountList;
  }>(PORT+'/api/user/address/count/list', {
    method: 'GET',
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`
    },
  });
}


/** 获取权限用户 GET /api/currentUser */
export async function userAdimnList() {
  return request<{
    data: API.UserAdmin;
  }>(PORT+'/api/jurisdiction/list', {
    method: 'POST',
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`
    },
  });
}

/**新增用户权限信息 */
export async function userAdminMenuInputAdd(
  params:API.UserAdmin
){
  return request<{data:number}>(
    PORT+"/api/add/jurisdiction/menu",{
      method:"POST",
      headers:{
        "Authorization":`${localStorage.getItem("token")}`,
        "TimeSystemCurrent":`${new Date().getTime()}`
      },
      data:params
    });
}

/**修改用户信息 */
export async function userAdminMenuUpdate(
  params:API.UserAdmin
){
return request<{data:number}>(
  PORT+"/api/update/jurisdiction/menu",{
    method:"PUT",
    headers:{
      "Authorization":`${localStorage.getItem("token")}`,
      "TimeSystemCurrent":`${new Date().getTime()}`
    },
    data:params
  });
}





